//package com.zmn.plat.dubbo.impl.service;
//
//import com.zmn.common.constant.GlobalConsts;
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.plat.business.interfaces.service.item.ServiceItemBService;
//import com.zmn.plat.common.dto.product.MaxAveragePriceDRO;
//import com.zmn.plat.common.dto.service.item.*;
//import com.zmn.plat.common.dto.service.itempart.ItemPartDRO;
//import com.zmn.plat.common.exception.PlatException;
//import com.zmn.plat.dubbo.interfaces.service.ServiceItemListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.service.itempart.ItemPart;
//import com.zmn.plat.services.interfaces.service.itempart.ItemPartService;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.beans.BeanUtils;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author tanbiao
// * @description
// * @modifier
// * @since 2019/12/26 19:32
// **/
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@Slf4j
//public class ServiceItemListRemoteServiceImpl implements ServiceItemListRemoteService {
//    @Resource
//    ServiceItemBService faultItemBService;
//    @Resource
//    ItemPartService itemPartService;
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<ServiceItemDRO> getById(Integer itemId) {
//        log.info("getById 参数为：itemId={}", itemId);
//
//        try {
//            ServiceItemDRO dro = faultItemBService.getById(itemId);
//            return ResponseDTO.success(dro);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getById error,itemId={}", itemId, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ProductServiceItemDRO>> listByDIO(ServiceItemServPriceDIO servItemPriceDIO) {
//        log.info("listByDIO 参数为：servItemPriceDIO={}", servItemPriceDIO);
//
//        try {
//            List<ProductServiceItemDRO> dro = faultItemBService.listByDIO(servItemPriceDIO);
//            return ResponseDTO.success(dro);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getById error，servItemPriceDIO={}", servItemPriceDIO, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ProductServiceItemDRO>> listByCategIdList(List<Integer> categIds) {
//        log.info("listByCategIdList 参数为：categIds={}", categIds);
//        return this.listByCategIdList(categIds, null);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ProductServiceItemDRO>> listByCategIdList(List<Integer> categIds, Integer companyId) {
//        log.info("listByCategIdList 参数为：categIds={}", categIds);
//        try {
//            List<ProductServiceItemDRO> dro = faultItemBService.listByCategIdList(categIds,companyId);
//            return ResponseDTO.success(dro);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listByCategIdList error,categIds={}", categIds, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ServiceItemDRO>> listByGroupId(Integer groupId) {
//        log.info("listByGroupId 参数为：groupId={}", groupId);
//
//        try {
//            List<ServiceItemDRO> dro = faultItemBService.listByGroupId(groupId);
//            return ResponseDTO.success(dro);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listByGroupId error,groupId={}", groupId, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ServiceItemDRO>> listByDIO(ServiceItemDIO query) {
//        log.info("listByDIO 参数为：listByDIO={}", query);
//
//        try {
//            List<ServiceItemDRO> dro = faultItemBService.listByDIO(query);
//            return ResponseDTO.success(dro);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listByDIO error,listByDIO={}", query, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<MaxAveragePriceDRO> getMaxAveragePriceByChannelIdAndTypeAndCityIdAndProductId(ServiceItemServDIO faultItemServDIO) {
//        log.info("getMaxAveragePriceByChannelIdAndTypeAndCityIdAndProductId 参数为：faultItemServDIO={}", faultItemServDIO);
//
//        try {
//            MaxAveragePriceDRO dio = faultItemBService.getMaxAveragePriceByChannelIdAndTypeAndCityIdAndProductId(faultItemServDIO);
//            return ResponseDTO.success(dio);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getMaxAveragePriceByChannelIdAndTypeAndCityIdAndProductId error,faultItemServDIO={}", faultItemServDIO, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ProductServiceItemDRO>> listByChannelIdAndTypeAndCityIdAndProductId(ServiceItemServDIO faultItemServDIO) {
//
//        log.info("listByChannelIdAndTypeAndCityIdAndProductId 参数为：faultItemServDIO={}", faultItemServDIO);
//        try {
//            List<ProductServiceItemDRO> list = faultItemBService.listByChannelIdAndTypeAndCityIdAndProductId(faultItemServDIO);
//            return ResponseDTO.success(list);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listByChannelIdAndTypeAndCityIdAndProductId error,faultItemServDIO={}", faultItemServDIO, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<ProductPriceTableDRO> getProductDefaultPriceTable(ServiceItemServDIO faultItemServDIO) {
//        log.info("getMaxAveragePriceByChannelIdAndTypeAndCityIdAndProductId 参数为：faultItemServDIO={}", faultItemServDIO);
//
//        try {
//            ProductPriceTableDRO dro = faultItemBService.getProductDefaultPriceTable(faultItemServDIO);
//            return ResponseDTO.success(dro);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getProductDefaultPriceTable error,faultItemServDIO={}", faultItemServDIO, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<Integer> getMaxServiceMinutes(Integer productId, List<Integer> itemIdList) {
//        log.info("getMaxServiceMinutes 参数为：productId={}，itemIdList：{}", productId, itemIdList);
//        return this.getMaxServiceMinutes(productId, itemIdList, null);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<Integer> getMaxServiceMinutes(Integer productId, List<Integer> itemIdList, Integer companyId) {
//        log.info("getMaxServiceMinutes 参数为：productId={}，itemIdList：{}", productId, itemIdList);
//
//        try {
//            Integer minutes = faultItemBService.getMaxServiceMinutes(productId, itemIdList, companyId);
//            return ResponseDTO.success(minutes);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getMaxServiceMinutes error", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ItemPartDRO>> getItemPartByItemId(List<Integer> itemIdList)
//    {
//
//        log.info("getItemPartByItemId 参数为：itemIdList：{}", itemIdList);
//        try {
//            List<ItemPartDRO> dros = new ArrayList<>();
//            List<ItemPart> itemParts = itemPartService.listByItemIds(itemIdList);
//            itemParts.forEach(item->{
//                ItemPartDRO dro = new ItemPartDRO();
//                BeanUtils.copyProperties(item,dro);
//                dros.add(dro);
//            });
//            return ResponseDTO.success(dros);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getItemPartByItemId error", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//}
